import localeMessageBox from '@/components/message-box/locale/en-US';
import localeSettings from './en-US/settings';
import localeAPI from '@/views/systemManage/api/locale/en-US';
import localeUser from '@/views/systemManage/user/locale/en-US';
import localeRole from '@/views/systemManage/role/locale/en-US';
import localeRule from '@/views/systemManage/rule/locale/en-US';
import localeCompany from '@/views/systemManage/company/locale/en-US';
//自动加载 views下的语言包
const autoLocle = import.meta.glob('@/views/**/locale/en-US.ts', {
  eager: true,
});

function formatModules(_modules: any, result: {}) {
  Object.keys(_modules).forEach((key) => {
    const defaultModule = _modules[key].default;
    if (!defaultModule) return;
    result = Object.assign({}, result, defaultModule);
  });
  return result;
}

export default {
  'menu.dashboard': 'Dashboard',
  'menu.systemManage': 'SystemManage',
  'navbar.action.locale': 'Switch to English',
  'searchTable.operation.create': 'Create',
  'searchTable.form.reset': 'Reset',
  'searchTable.form.search': 'Search',
  'searchTable.statusOptions.all': 'ALL',
  'searchTable.message.loading.updating': 'Updating',
  'searchTable.message.loading.update.successful': 'Update Successful',
  'searchTable.message.loading.adding': 'Adding',
  'searchTable.message.loading.add.successful': 'Add Successful',
  'searchTable.message.loading.deleting': 'Deleting',
  'searchTable.message.loading.delete.successful': 'Delete Successful',
  'searchTable.message.loading.delete.confirm':
    'Are you sure you want to delete?？',

  'searchTable.message.loading.resetting': 'Resetting',
  'searchTable.message.loading.reset.confirm':
    'Are you sure you want to reset your password?？',
  'searchTable.message.loading.reset.successful': 'Reset successful',

  'modal.helpMessage': 'Edit and Modify Menu',
  'modal.confirm': 'Ok',
  'modal.cancel': 'Cancel',
  'modal.selectAll': 'SelectAll',
  'modal.collapse' : 'Collapse',
  'modal.expand':'Expand',
  'modal.add': 'Add',
  'modal.edit': 'Edit',

  // size
  'searchTable.size.mini': 'mini',
  'searchTable.size.small': 'small',
  'searchTable.size.medium': 'middle',
  'searchTable.size.large': 'large',
  // actions
  'searchTable.actions.refresh': 'refresh',
  'searchTable.actions.density': 'density',
  'searchTable.actions.columnSetting': 'columnSetting',
  ...localeSettings,
  ...localeMessageBox,
  ...localeAPI,
  ...localeUser,
  ...localeRole,
  ...localeRule,
  ...localeCompany,
  ...formatModules(autoLocle, {}),
};
